/*
 * @Author: szx
 * @Date: 2022-02-20 13:22:02
 * @LastEditTime: 2022-02-20 13:23:09
 * @Description:
 * @FilePath: \leetcode\800-899\876\876.js
 */

function ListNode(val, next) {
    this.val = val === undefined ? 0 : val;
    this.next = next === undefined ? null : next;
}
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
var middleNode = function (head) {
    let slow = head;
    let fast = head;
    while (fast && fast.next) {
        slow = slow.next;
        fast = fast.next.next;
    }
    return slow;
};
